
File name
Commit message
Commit date
File name
Commit message
Commit date
File name
Commit message
Commit date
import plotly.graph_objects as go
import pandas as pd
import numpy as np
df = pd.read_csv('data/2020년_보건복지부_노인실태조사_운전여부.csv')
df = df.drop('그만둔 나이', axis=1)
df = df.set_index('연령')
colorscheme = ['#A5FFA7', '#FFE76E', '#FF8C5E']
fig = go.Figure()
for i, age in enumerate(df.columns):
fig.add_trace(
go.Bar(
x=df.index,
y=df.iloc[:,i],
name=df.columns[i],
marker_color=colorscheme[i],
customdata=df.iloc[:,i] * 100,
texttemplate="%{customdata:.1f}%",
textposition = 'inside'
)
)
fig.update_layout(barmode='stack')
fig.update_layout(
font_size=30
)
fig.update_yaxes(
tickformat= ',.0%',
range=[0,1]
)
fig.show()